@inject IUriHelper UriHelper
@inject Microsoft.JSInterop.IJSRuntime JSRuntime

<button @onclick="Navigate">Navigate</button>

<span id="test-info">@UrlLocation</span>

@code{
    string UrlLocation;

    protected override void OnInitialized()
    {
        UrlLocation = UriHelper.GetAbsoluteUri();
        UriHelper.OnLocationChanged += (_, __) =>
        {
            UrlLocation = UriHelper.GetAbsoluteUri();
            StateHasChanged();
        };
    }

    async Task Navigate()
    {
        await JSRuntime.InvokeAsync<object>("uriHelperNavigate");
    }
}

